package com.zfl.socket;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;

public class InetAddressDemo01 {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress doubao = InetAddress.getByName("www.doubao.com");
        System.out.println("doubao.getAddress() = " + doubao.getAddress());
        System.out.println("doubao.getHostAddress() = " + doubao.getHostAddress());
        System.out.println("doubao.getHostName() = " + doubao.getHostName());
        System.out.println("doubao.getCanonicalHostName() = " + doubao.getCanonicalHostName());

        Arrays.stream(InetAddress.getAllByName("www.doubao.com"))
                .forEach((inetAddress)->{
                    System.out.println("inetAddress.getHostAddress() = " + inetAddress.getHostAddress());
                });
    
    }
    
}
